package ccengine

type DomainReq struct {
	Id            string        `json:"id" comment:""`
	TenantId      string        `json:"tenant_id" comment:"租户" validate:"required"`
	Name          string        `json:"name"`
	Domain        string        `json:"domain"`
	ServiceType   string        `json:"serviceType"`
	Area          string        `json:"area"`
	ForceRedirect ForceRedirect `json:"forceRedirect"`
	Quic          Quic          `json:"quic"`
	Https         Https         `json:"https"`
	Origin        Origin        `json:"origin"`
	Cache         Cache         `json:"cache"`
	CacheKey      CacheKey      `json:"cacheKey"`
	Advance       Advance       `json:"advanced"`
	RefererFilter RefererFilter `json:"refererFilter"`
}

type ForceRedirect struct {
	Enable       int    `json:"enable"`
	RedirectType string `json:"redirectType"`
	RedirectCode int    `json:"redirectCode"`
}

type Quic struct {
	Enable int `json:"enable"`
}

type Https struct {
	Enable   int      `json:"enable"`
	Http2    int      `json:"http2"`
	CertInfo CertInfo `json:"certInfo"`
}

type CertInfo struct {
	CertId      string `json:"certId"`
	Certificate string `json:"certificate"`
	PrivateKey  string `json:"privateKey"`
}

type Origin struct {
	Origins            []string     `json:"origin"`
	OriginInfos        []OriginInfo `json:"origins"`
	OriginType         string       `json:"originType"`
	OriginPullProtocol string       `json:"originPullProtocol"`
	OriginArea         string       `json:"originArea"`
	BackupOrigins      []string     `json:"backupOrigins"`
	BackupOriginType   string       `json:"backupOriginType"`
	OriginHost         string       `json:"originHost"`
}

type OriginInfo struct {
	Servers       []Server        `json:"servers"`
	StandByServer []StandByServer `json:"standbyServers"`
	MatchType     string          `json:"matchType"`
	MatchRule     string          `json:"matchRule"`
	Algorithm     string          `json:"algorithm"`
	Using         string          `json:"using"`
}

type Server struct {
	OriginType         string `json:"originType"`
	OriginPullProtocol string `json:"originPullProtocol"`
	Target             string `json:"target"`
	OriginHost         string `json:"originHost"`
}

type StandByServer struct {
	OriginType         string `json:"originType"`
	OriginPullProtocol string `json:"originPullProtocol"`
	Target             string `json:"target"`
	OriginHost         string `json:"originHost"`
}

type Cache struct {
	CacheRules         []CacheRule `json:"cacheRules"`
	IgnoreCacheControl string      `json:"ignoreCacheControl"`
}

type CacheRule struct {
	CacheType     string `json:"cacheType"`
	CacheContents string `json:"cacheContents"`
	CacheTime     int    `json:"cacheTime"`
	FollowOrigin  string `json:"followOrigin"`
	Unit          string `json:"unit"`
}

type CacheKey struct {
	FullUrlCache string        `json:"fullUrlCache"`
	QueryString  []QueryString `json:"queryString"`
}

type QueryString struct {
	CacheType     string `json:"cacheType"`
	CacheContents string `json:"cacheContents"`
	Action        string `json:"action"`
	Value         string `json:"value"`
}

type DomainRes struct {
	Id     string `json:"id"`
	Cname  string `json:"cname"`
	ZoneId string `json:"zoneId"`
}

type CertificateReq struct {
	TenantId         string             `json:"tenant_id" comment:"租户" validate:"required"`
	SslCertification []SslCertification `json:"ssl_certification"`
}

type SslCertification struct {
	Name    string `json:"name"`
	SslCert string `json:"ssl_cert"`
	SslKey  string `json:"ssl_key"`
}

type PreHotUrlReq struct {
	Id       string `json:"id"`
	TenantId string `json:"tenant_id" comment:"租户" validate:"required"`
	Paths    Paths  `json:"paths"`
}

type PreHotUrlRes struct {
	TaskId string `json:"task_id"`
}

type Paths struct {
	Dir []string `json:"dir"`
	Uri []string `json:"uri"`
}

type VerifyReq struct {
	TenantId string `json:"tenant_id" comment:"租户"`
	Domain   string `json:"domain"`
}

type VerifyReq2 struct {
	TenantId string `json:"tenant_id" comment:"租户"`
	Id       int    `json:"id"`
	TaskId   string `json:"task_id"`
}

type VerifyRes struct {
	Status    string `json:"status"`
	TxtRecord string `json:"txtRecord"`
	Txt       string `json:"txt"`
}

type CheckPemReq struct {
	Pem string `json:"pem"`
}

type CheckPemRes struct {
	Name      string `json:"name"`
	ValidFrom string `json:"validFrom"`
	ValidTo   string `json:"validTo"`
}

type Advance struct {
	Ipv6Accelerate          string                    `json:"ipv6_accelerate"`
	ForceRedirectionEnable  string                    `json:"force_redirection_enable"`
	SpecialCacheCodeList    []SpecialCacheCode        `json:"special_cache_code_list"`
	Range                   Range                     `json:"range"`
	IpControl               IpControl                 `json:"ipControl"`
	UaControl               UaControl                 `json:"uaControl"`
	UrlSign                 UrlSign                   `json:"urlSign"`
	CdnRequestHeaderPolicy  []CdnRequestHeaderPolicy  `json:"cdn_request_header_policy"`
	CdnResponseHeaderPolicy []CdnResponseHeaderPolicy `json:"cdn_response_header_policy"`
	OriginTimeout           int                       `json:"originTimeout"`
	Compress                Compress                  `json:"compress"`
	TlsVersion              string                    `json:"tlsVersion"`
}

type Compress struct {
	Status   string `json:"status"`
	Type     string `json:"type"`
	FileType string `json:"file_type"`
}

type CdnRequestHeaderPolicy struct {
	NewHeaderKey   string `json:"new_header_key"`
	NewHeaderValue string `json:"new_header_value"`
	Type           string `json:"type"`
}

type CdnResponseHeaderPolicy struct {
	NewHeaderKey   string `json:"new_header_key"`
	NewHeaderValue string `json:"new_header_value"`
	Type           string `json:"type"`
}

type UrlSign struct {
	Status         string   `json:"status"`
	Type           string   `json:"type"`
	SignMethod     string   `json:"sign_method"`
	Keys           []string `json:"keys"`
	SessionTimeout string   `json:"sessionTimeout"`
	SignArg        string   `json:"sign_arg"`
}

type IpControl struct {
	Enable string   `json:"enable"`
	Type   string   `json:"type"`
	Ips    []string `json:"ips"`
}

type UaControl struct {
	Enable string   `json:"enable"`
	Type   string   `json:"type"`
	UaList []string `json:"ua_list"`
}

type SpecialCacheCode struct {
	Code       string `json:"code"`
	Expiration string `json:"expiration"`
}
type Range struct {
	Enable int `json:"enable"`
}

type RefererFilter struct {
	WhitelistEnable string   `json:"whitelist_enable"`
	BlacklistEnable string   `json:"blacklist_enable"`
	Whitelist       []string `json:"whitelist"`
	Blacklist       []string `json:"blacklist"`
	IncludeEmpty    bool     `json:"include_empty"`
}

type OriginUrlRewriteReq struct {
	Id            int    `json:"id" comment:"租户"`
	TenantId      string `json:"tenant_id" comment:"租户"`
	DomainId      int    `json:"domain_id"`
	ExactlyMatch  string `json:"exactly_match"`
	OriginUrl     string `json:"origin_url"`
	DestPath      string `json:"dest_path"`
	DestHost      string `json:"dest_host"`
	OverWriteType int    `json:"over_write_type"`
	DomainTaskId  string `json:"domain_task_id"`
	OverwriteKind string `json:"type"`
}
type GetOriginUrlRewriteReq struct {
	Id            int    `json:"id" comment:"租户"`
	DomainId      int    `json:"domain_id"`
	TenantId      string `json:"tenant_id" comment:"租户"`
	OverWriteType int    `json:"over_write_type"`
	DomainTaskId  string `json:"domain_task_id"`
}

type SaveUrlRewriteReq struct {
	TenantId     string `json:"tenant_id" comment:"租户"`
	DomainId     int    `json:"domain_id"`
	DomainTaskId string `json:"domain_task_id"`
	UrlRewrites  []UrlRewrite
}

type GetUrlRewriteReq struct {
	TenantId     string `json:"tenant_id" comment:"租户"`
	DomainId     int    `json:"domain_id"`
	DomainTaskId string `json:"domain_task_id"`
	UrlRewrites  []UrlRewrite
}

type UrlRewrite struct {
	TenantId     string `json:"tenant_id" comment:"租户"`
	DomainId     int    `json:"domain_id"`
	ExactlyMatch string `json:"exactly_match"`
	Origin       string `json:"origin"`
	Dest         string `json:"dest"`
	Type         string `json:"type"`
}

type DeleteUrlRewriteReq struct {
	Ids           []int `json:"ids" comment:""`
	DomainId      int   `json:"domain_id"`
	OverWriteType int   `json:"over_write_type"`
}
type MoveDown struct {
	Id            int `json:"id" comment:"" validate:"required"` //
	DomainId      int `json:"domain_id" comment:"基本信息id" `
	OverWriteType int `json:"over_write_type" comment:"基本信息id""`
	Type          int `json:"type" comment:"移动类型 1 上移 2下移"  validate:"required,gt=0"`
}

type GetIpInfoReq struct {
	TenantId string `json:"tenant_id" comment:"租户"`
	Ips      string `json:"ips"`
}

type CdnIps struct {
	CdnIps []CdnIp `json:"cdn_ips"`
}

type CdnIp struct {
	Ip       string      `json:"ip"`
	Region   string      `json:"region"`
	Platform interface{} `json:"platform"`
	Isp      string      `json:"isp"`
	Belongs  bool        `json:"belongs"`
}

type RefreshPreheatReq struct {
	TaskId string `json:"task_id"`
}

type RefreshPreheatRes struct {
	Id           string `json:"id"`
	TenantId     string `json:"tenant_id"`
	Url          string `json:"url"`
	UrlId        string `json:"url_id"`
	TaskId       string `json:"task_id"`
	Status       string `json:"status"`
	TaskType     string `json:"task_type"`
	FailClassify string `json:"fail_classify"`
	FailDesc     string `json:"fail_desc"`
	CreateTime   int64  `json:"create_time"`
}
